package com.yulang.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yulang.entity.SysPermission;
import com.yulang.mapper.SysPermissionMapper;
import com.yulang.service.SysPermissionService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, SysPermission> implements SysPermissionService {


    @Transactional(rollbackFor = Exception.class)
    @Override
    public void deleteById(String id) {
        removeById(id);
        UpdateWrapper<SysPermission> update = new UpdateWrapper<>();
        update.lambda().eq(SysPermission::getParentId,id);
        remove(update);
    }
}
